package com.gzq.composite.sgw;

import java.util.ArrayList;
import java.util.List;

public class University extends OrganizationComponent{
    private List<OrganizationComponent> colleges = new ArrayList<>();

    @Override
    public void print() {
        System.out.println("--------"+this.getName()+"--------");
        for (OrganizationComponent oc: colleges){
            oc.print();
        }
    }

    public University(String name, String desc) {
        super(name, desc);
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        colleges.add(organizationComponent);
    }

    @Override
    public void remove(OrganizationComponent organizationComponent) {
        colleges.remove(organizationComponent);
    }
}
